import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import helloTest from '@/views/helloTest'
import UserTest from '@/views/UserTest'
import Main from '@/views/Main.vue'
import Mall from "../views/Mall.vue"
import pageOne from "../views/PageOne.vue";
import pageTwo from "../views/PageTwo.vue";
import Home from "../views/Home.vue";

Vue.use(Router)

export default new Router({
    routes: [
        // {
        //   path: '/',
        //   name: 'HelloWorld',
        //   component: HelloWorld
        // },
        {
            path: '/',
            component: Main,
            redirect: '/home',
            // 子路由
            children: [
                // {path: 'home', component:Main},
                {
                    // 子路由中不能加'/'
                    path: 'hello',
                    name: 'helloTest',
                    component: helloTest
                },
                {
                    path: 'user',
                    name: 'user',
                    component: UserTest
                },
                {
                    path: 'helloworld',
                    name: 'helloWorld',
                    component: HelloWorld
                },
                {path: 'mall', name: 'mall', component: Mall},
                {path: 'pageone', name: 'page1', component: pageOne},
                {path: 'pagetwo', name: 'page2', component: pageTwo},
                {path: 'home', name: 'home', component: Home},
            ]
        }
        // {
        //   path: '/hello',
        //   name: 'helloTest',
        //   component: helloTest
        // },
        // {
        //   path: '/user',
        //   name: 'UserTest',
        //   component: UserTest
        // }
    ]
})
